package com.gzit.dialog;

import java.util.HashMap;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.AdapterView.OnItemClickListener;

import com.gzit.adapter.CustomerListAdapter;
import com.gzit.dialog.framework.ManagedActivityDialog;
import com.gzit.dialog.framework.ManagedDialogsActivity;


/**
 * ���һ���й� ���б�� �Ի���
 * 
 * ���������ݵı仯ˢ��ListView
 * 
 * @author gzit
 * 
 */
public class GenericManagedListDialog extends ManagedActivityDialog implements
		OnItemClickListener {

	private CustomerListAdapter adapter;
	private int contentViewId;
	private Context ctx;
	private ListView listView;
	private String title; // �Ի����title

	AlertDialog dialog;

	public GenericManagedListDialog(ManagedDialogsActivity a, int dialogId,
			CustomerListAdapter adapter, int contentViewId, String title) {
		super(a, dialogId);
		this.adapter = adapter;
		this.contentViewId = contentViewId;
		this.ctx = a;
		this.title = title;
	}

	public Dialog create() {
		
		LayoutInflater li = LayoutInflater.from(ctx);
		ViewGroup viewGroup = (ViewGroup) li.inflate(contentViewId, null);
//		ListView listView = (ListView) viewGroup.findViewById(R.id.list);
		listView.setOnItemClickListener(this);
		listView.setAdapter(adapter);
		AlertDialog.Builder builder = new AlertDialog.Builder(ctx);
		builder.setTitle(title);
		builder.setView(viewGroup);

		// builder.setPositiveButton("OK", this);
		builder.setNegativeButton("����", this);
		dialog = builder.create();

		return dialog;

	}

	public void onClickHook(int buttonId) {

	}

	public void prepare(Dialog dialog) {

	}

	public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
	

	}

}
